package ru.ksu.ktk.diploma.sdi.dao.util;

public class Util {
    private static final String XML_EXTENSION = "xml";

    public static boolean hasXmlExtension(String fileName) {
        if (fileName == null) throw new IllegalArgumentException("file name cannot be null");
        int dotIndex = fileName.lastIndexOf(".");
        if (dotIndex == -1) throw new IllegalArgumentException("file name is incorrect");
        String extension = fileName.substring(dotIndex + 1);
        return extension.equalsIgnoreCase(XML_EXTENSION);
    }
}
